const Sequelize=require("sequelize")
//数据库名称 用户名称 密码 配置项
const {
    dbName,
    user,
    pass,
    host,
    port
}=require("../config/config").database
const sequelize=new Sequelize(dbName,user,pass,{
     dialect:"mysql",
     host:host,
     port:port
})
sequelize.authenticate().then(()=>{
    console.log("数据库连接成功")
}).catch(error=>{
    console.log(error)
    console.log("连接失败")
})
module.exports={
    db:sequelize
}